﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

using DaphneTranslator.BusinessLogic;
using System.Collections.ObjectModel;

namespace DaphneTranslatorWPF.ViewModel
{
    /// <summary>
    /// View Model for tree control of files and cultures
    /// </summary>
    public class LanguageTreeControlViewModel: INotifyPropertyChanged
    {
        private CultureCollection m_CultureCollection;
        private LanguageFile m_SelectedFile;


        public LanguageTreeControlViewModel()
        {
        }

        /// <summary>
        /// Returns selected file in the data grid
        /// </summary>
        public LanguageFile SelectedFile
        {
            get
            {
                return m_SelectedFile;
            }            
        }

        public ObservableCollection<TreeDataViewModel> Items
        { get; set; }

        /// <summary>
        /// Sets the data
        /// </summary>
        /// <param name="cultureCollection"></param>
        public void SetCultureCollection(CultureCollection cultureCollection)
        {
            m_CultureCollection = cultureCollection;
            Items = TreeDataViewModel.ParseCultureCollection(m_CultureCollection);
        }


        public void OnPropertyChanged(string sProperty)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(sProperty));
            }
        }

        public event PropertyChangedEventHandler PropertyChanged;
    }
}
